package cn.fl.dk.web.transform;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.dk.base.transform.BaseDkBillDtlVOTransform;
import cn.fl.dk.facade.dto.DkBillDtlDTO;
import cn.fl.dk.web.vo.DkBillDtlVO;

import java.util.ArrayList;
import java.util.List;


/**
 * @Description: 垫款单明细表 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class DkBillDtlVOTransform extends BaseDkBillDtlVOTransform {


	/**
	 * DTO 转  VO
	 * @return DkBillDtlVO
	 */
	public static DkBillDtlVO toVO(DkBillDtlDTO dto) {
		DkBillDtlVO  vo = baseToVO(dto);
		//设置自定义扩展属性
		if(StringUtils.isNotEmpty(dto.getQuestneId()))
			vo.setQuestneId(dto.getQuestneId());
		if(StringUtils.isNotEmpty(dto.getQtnRstCd()))
			vo.setQtnRstCd(dto.getQtnRstCd());
		if(StringUtils.isNotEmpty(dto.getSignStsCd()))
			vo.setSignStsCd(dto.getSignStsCd());
		if(dto.getPushTm() != null)
			vo.setPushTm(dto.getPushTm());
		if(StringUtils.isNotEmpty(dto.getContNo()))
			vo.setContNo(dto.getContNo());
		if(StringUtils.isNotEmpty(dto.getOverdueAmount()))
			vo.setOverdueAmount(dto.getOverdueAmount());
		if(StringUtils.isNotEmpty(dto.getOverdueDay()))
			vo.setOverdueDay(dto.getOverdueDay());
		if(StringUtils.isNotEmpty(dto.getPrdStsCd()))
			vo.setPrdStsCd(dto.getPrdStsCd());
		if(dto.getOverdueAmountYuan() != null)
			vo.setOverdueAmountYuan(dto.getOverdueAmountYuan());
		if(dto.getEstimateRedeemAmtYuan() != null)
			vo.setEstimateRedeemAmtYuan(dto.getEstimateRedeemAmtYuan());
		if(dto.getActualRedeemAmtYuan()!=null)
			vo.setActualRedeemAmtYuan(dto.getActualRedeemAmtYuan());
		if(dto.getSignTm()!=null)
			vo.setSignTm(dto.getSignTm());
		if(StringUtils.isNotEmpty(dto.getContractId()))
			vo.setContractId(dto.getContractId());
		if(StringUtils.isNotEmpty(dto.getRansomExecCd()))
			vo.setRansomExecCd(dto.getRansomExecCd());
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @return DkBillDtlDTO
	 */
	public static DkBillDtlDTO toDTO(DkBillDtlVO vo) {
		DkBillDtlDTO dto = baseToDTO(vo);
		//设置自定义扩展属性
		dto.setQuestneId(vo.getQuestneId());
		dto.setContractId(vo.getContractId());
		dto.setQtnRstCd(vo.getQtnRstCd());
		dto.setSignStsCd(vo.getSignStsCd());
		dto.setPushTm(vo.getPushTm());
		dto.setContNo(vo.getContNo());
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @return List<DkBillDtlVO>
	 */
	public static List<DkBillDtlVO> toVOList(List<DkBillDtlDTO> list) {
		List<DkBillDtlVO>  voList = new ArrayList<DkBillDtlVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (DkBillDtlDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<DkBillDtlVO>
	 * @return List<DkBillDtlDTO>
	 */
	public static List<DkBillDtlDTO> toDTOList(List<DkBillDtlVO> list) {
		List<DkBillDtlDTO>  dtoList = new ArrayList<DkBillDtlDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (DkBillDtlVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
